package com.dao;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.hibernate.pojo.Order;

@Controller("orderDao")
public class OrderDao extends Basedao {
	
	@Resource(name="order")
	private Order order;
	
	public boolean addOrder(Order or,int userId){
		try {
			getSession().save(or);
			getSession().createQuery("delete Shopcar sc where sc.userId=?").setInteger(0, userId).executeUpdate();
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
	
}
